/**
 * 创建下载任务
 * @param {Object} url
 * @param {Object} option
 */
const createDownload = function(url,option){
	console.log('开始下载',url,option)
	var dtask = plus.downloader.createDownload(url, option, function(download, status){
		// 下载完成
		if(status == 200){ 
			console.log(download)
			console.log("Download success: " + download.filename);
		} else {
			 console.log("Download failed: " + status); 
		}  
	});
	dtask.start(); 
	console.log(dtask)
}
/**
 * 枚举下载任务
 */
const enumerateDwonload = function(){
	plus.downloader.enumerate(function(tasks){
		console.log("Unfinished task count: " + tasks.length);
	});
}

export default{
	createDownload,
	enumerateDwonload
}